<template>
  <el-dialog v-model="visible" :title="'详情'" :close-on-click-modal="false" :close-on-press-escape="false">
    <el-form  :model="dataForm" :rules="rules" ref="dataFormRef" @keyup.enter="dataFormSubmitHandle()" label-width="120px" disabled="true">
<!--          <el-form-item label="关联的采购项目" prop="purchaseProjectId">-->
<!--            <el-input v-model="dataForm.purchaseProjectId" placeholder=""></el-input>-->
<!--          </el-form-item>-->
          <el-form-item label="标包名称" prop="sectionName">
            <el-input v-model="dataForm.sectionName" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="标包编号" prop="sectionCode">
            <el-input v-model="dataForm.sectionCode" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="标包内容" prop="sectionContent">
            <el-input v-model="dataForm.sectionContent" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="标包类别" prop="sectionCategory">
            <ren-radio-group v-model="dataForm.sectionCategory" dict-type="purchase_project_type"></ren-radio-group>
          </el-form-item>
          <el-form-item label="标包概算金额(元)" prop="estimatesMoney">
        <el-input v-model="dataForm.estimatesMoney" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="是否要求上传资质" prop="isAptitude">
            <ren-radio-group v-model="dataForm.isAptitude" dict-type="is_or_no"></ren-radio-group>
      </el-form-item>
          <el-form-item label="标段状态" prop="dealStatus">
        <ren-radio-group v-model="dataForm.dealStatus" dict-type="deal_status"></ren-radio-group>
      </el-form-item>
          <el-form-item label="成交金额(元)" prop="dealMoney">
        <el-input v-model="dataForm.dealMoney" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="成交企业共享平台" prop="dealBodyShareId">
        <el-input v-model="dataForm.dealBodyShareId" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="成交企业名称" prop="dealBodyName">
        <el-input v-model="dataForm.dealBodyName" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="成交时间" prop="dealTime">
        <el-input v-model="dataForm.dealTime" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="项目创建人" prop="createUser">
        <el-input v-model="dataForm.createUser" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="项目创建时间" prop="createTime">
        <el-input v-model="dataForm.createTime" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="最后更新人" prop="updateUser">
        <el-input v-model="dataForm.updateUser" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="最后更新时间" prop="updateTime">
        <el-input v-model="dataForm.updateTime" placeholder=""></el-input>
      </el-form-item>
      </el-form>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, ref } from "vue";
import baseService from "@/service/baseService";
import { ElMessage } from "element-plus";
const emit = defineEmits(["refreshDataList"]);

const visible = ref(false);
const dataFormRef = ref();

const dataForm = reactive({
  sectionId: '',  purchaseProjectId: '',  sectionName: '',  sectionCode: '',  sectionContent: '',  sectionCategory: '',  estimatesMoney: '',  isAptitude: '',  dealStatus: '',  dealMoney: '',  dealBodyShareId: '',  dealBodyName: '',  dealTime: '',  createUser: '',  createTime: '',  updateUser: '',  updateTime: ''});
const init = (sectionId?: number) => {
  visible.value = true;
  dataForm.sectionId = "";

  // 重置表单数据
  if (dataFormRef.value) {
    dataFormRef.value.resetFields();
  }

  if (sectionId) {
    getInfo(sectionId);
  }
};

// 获取信息
const getInfo = (sectionId: number) => {
  baseService.get("/section/section/" + sectionId).then((res) => {
    Object.assign(dataForm, res.data);
  });
};

defineExpose({
  init
});
</script>
